#-------------------------------------------------------------------
# This file is part of the CMake build system for ogre-url
#-------------------------------------------------------------------

cmake_minimum_required (VERSION 2.6)

# set cmake policy
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
cmake_policy(SET CMP0003 NEW)

project (OgreURL)

# add some functions we use that are shipped with cmake
include (CheckLibraryExists)
include (CheckIncludeFile)
include (CheckIncludeFileCXX)
include (CheckCCompilerFlag)
include (CheckCSourceCompiles)

# Create debug libraries with _d postfix
if (NOT APPLE)
	set (CMAKE_DEBUG_POSTFIX "_d")
endif (NOT APPLE)

# msvc specific options
if (MSVC)
	option (SETUP_ENABLE_PRECOMPILED_HEADERS "Enable precompiler headers for OgreURL and Demo application" TRUE)
endif (MSVC)

# Include necessary submodules
set (CMAKE_MODULE_PATH 
	"${CMAKE_HOME_DIRECTORY}/CMake"
	"${CMAKE_HOME_DIRECTORY}/CMake/Packages"
	"${CMAKE_HOME_DIRECTORY}/CMake/Utils"
)


# check dependencies
include (Dependencies)

# configure global build settings
include (ConfigureBuild)

# Specify build paths
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")

# Install CMake modules
add_subdirectory (CMake)

# Setup OgreURL project
add_subdirectory (OgreURL)

# Setup Plugin_OgreURL project
add_subdirectory (Plugin)

# Setup Demo project
if (SETUP_OGREURL_BUILD_DEMO)
	add_subdirectory (Demo)
endif (SETUP_OGREURL_BUILD_DEMO)
